package controller;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.ibatis.session.SqlSession;

import bean.Orders;
import mapper.OrdersMapper;
import service.OrdersService;
import service.OrdersServiceImpl;
import util.MybatisUtil;


@WebServlet("/AlipayIndexController")
public class AlipayIndexController extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		  
		  int orderUser = 1;
		  SqlSession sqlSession = MybatisUtil.getSqlSession();
		  OrdersMapper mapper = sqlSession.getMapper(OrdersMapper.class);
		  ArrayList<Orders> list= mapper.getAllOrdersAndOrdersStatusAndOrdersDetail(orderUser);

		  request.setAttribute("allOrders", list);
	      request.getRequestDispatcher("alipay.index.jsp").forward(request, response);
	      //http://localhost:9527/aomaotuan/alipay.index.jsp/233/1/goods
	      //http://localhost:9527/aomaotuan/AlipayIndexController
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
